public class demo1 {
    private static boolean isQuit=false;
    private static int count =0;

    public static void main(String[] args) {
        Thread t=new Thread(()->{
           while(!isQuit){
               System.out.println(count==0);
               count++;
           }
        });
        t.start();
        Thread t2=new Thread(()->{
            try{
                Thread.sleep(100);
                isQuit=true;
                count=0;
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        });
        t2.start();
        int i=0;
        while(i<100){
            System.out.println(count);
            i++;
        }
    }
}
